<?php

/*
 * @file Local.php
 * @description 
 * @author Alexis Thou
 * @date 16 sept. 2012
 * 
 */


class Model_Local extends Model {

    public $_table = 'local';
    public $_primary_key = 'id';
    private static $_instance;
    public $data;
    
    static function getInstance() {
        if (empty(self::$_instance))
            self::$_instance = new Model_Local();
        return self::$_instance;
    }
    
    function __construct() {
        parent::__construct($this->_table);
        $this->data = $this->setData();
    }
    function languages(){
        return array('en','kh');
    }
    private function setData(){
        $data = array();
        foreach($this->selectAll() as $key => $value){
            foreach($this->languages() as $lang){
                $data[$value->def][$lang] = $value->{$lang};    
            }
        }
        return $data;
    }

}
?>
